<?php
function smarty_function_bytesConvert($params, $template) {
	$bytes = $params["bytes"];
	$ext = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
	$unitCount = 1;
	for(; $bytes > 1024; $unitCount++) $bytes /= 1024;
	return round($bytes, 2) ." ". $ext[$unitCount];
}
?>